package com.jack.mvvmexample.api.network

import com.jack.mvvmexample.api.ApiService
import com.jack.mvvmexample.utils.RetrofitClient

class HomeNetwork {

    private val mService by lazy { RetrofitClient.getInstance().create(ApiService::class.java) }

    suspend fun getVideoList() = mService.getVideoList()

    companion object {
        @Volatile
        private var netWork: HomeNetwork? = null

        fun getInstance() = netWork ?: synchronized(this) {
            netWork ?: HomeNetwork().also { netWork = it }
        }
    }
}